package chamans.away
{
	import away3d.materials.BitmapMaterial;
	import away3d.primitives.Plane;
	import away3d.entities.Mesh;
	
	public class sol extends Mesh
	{
		private var BASE:Object;
		private var size:int;
		private var division:int;
		private var UVscale:Number;
		private var END:Function;
		public var mat:BitmapMaterial;
		
		public function sol(base:Object, end:Function=null, s:int=100000 ,div:int=50, uvscale:Number=500 ):void
		{
			BASE = base;
			size=s;
			division=div
			UVscale=uvscale;
			END = end;
			BASE.LOAD.IMGLIST("assets/ground/", ['sol_color', "sol_luma", "sol_normal", "wall"], Init_Material , ".jpg")
		}
		
		private function Init_Material(A:Array):void
		{
			mat = new BitmapMaterial(A[0],true,true,true);
			mat.lights = BASE.LIGHT;
			mat.specular =1;
			mat.gloss =10;
			mat.ambient = 0.2;
			mat.ambientColor = BASE.FogColor;
			mat.normalMap=A[2];
			mat.specularMap=A[1];
			mat.name="Ground";
			BASE.F_Fog(mat);
			BASE.MatListe.push( mat );
			Add_Plan();
		}
		private function Add_Plan():void
		{
			var plan:Mesh =new Plane(mat, size, size, division,division);
			BASE.view.scene.addChild(plan);
			plan.castsShadows = false;
			plan.geometry.scaleUV(UVscale);
			plan.rotationX=-90;
			if (END!=null)END()
		}
		//END
	}}